@layout("/common/_container.html"){
<style>
    .searchbox {
        margin: 10px 10px 0 20px;
    }

    .button-ba {
        margin: 10px 0 10px 20px;
    }

    .staticbox {
        display: flex;
        align-items: center;
        margin: 20px 0 10px 20px;
        font-size: 16px;
        font-weight: bold;
        color: #000000;
    }

    .static-one {
        margin-right: 30px;
    }

    .static-val {
        color: #F59A23;
    }

    .el-form-item {
        margin-bottom: 0
    }

    .tables {
        margin: 0 20px;
    }

    .reject {
        color: red;
    }

    .reject-title {
        font-size: 20px;
        font-family: Helvetica;
    }
    .text_style {
        font-size: 16px;
    }

    .pages {
        margin-top: 20px;
    }

    .textColor {
        color: lightskyblue;
        margin-bottom: 10px
    }
    .my-button {
        margin: 20px auto;
        width: 200px;
        height: 30px;
        text-align: center;
        line-height: 35px;
        border-radius: 5px;
        cursor: pointer;
        margin-bottom: 20px;
        /*position: fixed;*/
        /*bottom: 0;*/
    }
</style>
</head>

<body>
    <!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
    <script src="/assets/common/module/vuejs/vue.dev.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="/assets/common/module/element-ui/lib-master/theme-chalk/index.css">
    <link rel="stylesheet" href="/assets/common/module/element-ui/lib-master/theme-chalk/display.css">
    <link rel="stylesheet" href="/assets/common/css/beautiful.css">
    <!-- 引入组件库 -->
    <script src="/assets/common/module/element-ui/lib-master/index.js"></script>

    <div id="app">
        <div class="searchbox">
            <el-form :inline="true" v-show="form2Visible" label-position="left" :model="form2" class="demo-form-inline" label-width="90px">
                <el-form-item :style="formItemStyle" label="离职状态:">
                    <el-select v-model="form2.departureStatus" size="small" placeholder="请选择" style="width: 200px">
                        <el-option v-for="item in departureStatusData" :key="item.value" :label="item.name"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item :style="formItemStyle" label="打卡记录:">
                    <el-select v-model="form2.dingdingAttendHave" size="small" placeholder="请选择" style="width: 200px">
                        <el-option v-for="item in dingdingAttendHaveData" :key="item.value" :label="item.name"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item :style="formItemStyle" label="最新数据:">
                    <el-select v-model="form2.dingdingAttendNew" size="small" placeholder="请选择" style="width: 200px">
                        <el-option v-for="item in dingdingAttendNewData" :key="item.value" :label="item.name"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
            </el-form>
        </div>
        <div class="searchbox">
            <el-form :inline="true" :model="form1" class="demo-form-inline" label-position="left"label-width="90px">
                <el-form-item :style="formItemStyle" label="一级区域:">
                    <el-select v-model="form1.province" filterable placeholder="请选择" size="small" v-on:change="changePr"
                        style="width: 200px">
                        <el-option v-for="(item,index) in provinceList" :key="index" :label="item.name"
                            :value="item.deptId">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item :style="formItemStyle" label="二级区域:">
                    <el-select v-model="form1.city" filterable placeholder="请选择" size="small" v-on:change="changeCi"
                        style="width: 200px">
                        <el-option v-for="(item,index) in cityList" :key="index" :label="item.name"
                            :value="item.deptId">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item :style="formItemStyle" label="三级区域:">
                    <el-select v-model="form1.region" filterable placeholder="请选择" size="small" v-on:change="changeRe"
                        style="width: 200px">
                        <el-option v-for="(item,index) in regionList" :key="index" :label="item.name"
                            :value="item.deptId">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item :style="formItemStyle" label="四级区域:">
                    <el-select v-model="form1.street" filterable placeholder="请选择" size="small" style="width: 200px">
                        <el-option v-for="(item,index) in streetList" :key="index" :label="item.name"
                            :value="item.deptId">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item :style="formItemStyle">
                    <el-button type="primary" class="btybtn" size="small" v-on:click="searchDo1">搜索</el-button>
                    <el-button size="small" style="margin-right: 10px;" v-on:click="resetDo1">重置</el-button>
                    <el-button type="primary" class="btybtn" size="small" v-on:click="exportDo1">导出</el-button>
                    <el-button type="primary" class="btybtn" size="small" v-on:click="exportDoGroup1">分组导出</el-button>
                </el-form-item>
            </el-form>
        </div>

        <div class="searchbox">
            <el-form :inline="true" label-position="left"  :model="form" class="demo-form-inline" label-width="90px">
                <el-form-item :style="formItemStyle" label="营运经理:">
                    <el-select v-model="form.manager" filterable size="small" v-on:change="changeManager"
                        placeholder="请选择" style="width: 200px">
                        <el-option v-for="(item,index) in managerData" :key="index" :label="item.yyjl"
                            :value="item.yydh">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item :style="formItemStyle" label="督导:">
                    <el-select v-model="form.supervisor" filterable size="small" v-on:change="changeSupervisor"
                        placeholder="请选择" style="width: 200px">
                        <el-option v-for="(item,index) in supervisorData" :key="index" :label="item.dd"
                            :value="item.dddh">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item :style="formItemStyle" label="店名:">
                    <el-select v-model="form.store" filterable size="small" value-key="ym" v-on:change="changeStore"
                        placeholder="请输入店名或妖码查询" style="width: 200px">
                        <el-option v-for="(item,index) in storeData" :key="index" :label="item.dm" :value="item.dm">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item :style="formItemStyle" label="员工姓名/ID:">
                    <el-input placeholder="请输入员工姓名或ID查询" v-model="form.uname" clearable style="width: 200px">
                    </el-input>
                </el-form-item>
                <el-form-item :style="formItemStyle">
                    <el-button type="primary" class="btybtn" size="small" v-on:click="searchDo">搜索</el-button>
                    <el-button size="small" v-on:click="resetDo" style="margin-right: 10px;">重置</el-button>
                    <el-button type="primary" class="btybtn" size="small" v-on:click="exportDo2">导出</el-button>
                    <el-button type="primary" class="btybtn" size="small" v-on:click="exportDoGroup2">分组导出</el-button>
                </el-form-item>
            </el-form>
        </div>
        <el-row>
            <el-col :span="2">
                <div class="button-ba">
                    <el-button type="primary" class="btybtn" size="small" v-on:click="showMore">高级查询条件</el-button>
                </div>
            </el-col>
            <el-col :span="2">
                <div class="button-ba">
                    <el-button type="danger" size="small" v-on:click="deleteBar(sels)" v-show="flag">一键删除</el-button>
                </div>
            </el-col>
        </el-row>
        <div class="tables">
            <el-table v-loading="loading" :data="tableData" highlight-current-row
                :cell-style="{fontSize:'14px'}"
                :header-cell-style="headerStyle"  
                border style="width: 100%;" 
                size="small"
                v-on:selection-change="handleSelectionChange" 
                :height="tableHeight">
                <el-table-column type="selection" width="60">
                </el-table-column>
                <el-table-column prop="" label="序号" align="center" width="60">
                    <template scope="scope">
                        <span>{{(pageIndex - 1) * pagesize + scope.$index + 1}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="fullName" label="钉钉部门" width="150">
                    <template scope="scope">
                    <el-popover
                        placement="top"
                        v-if="scope.row.fullName"
                        popper-class="popper"
                        width="300"
                        trigger="hover">
                        <div>
                            {{scope.row.fullName}}
                        </div>
                        <div class="hideone" slot="reference">
                            {{scope.row.fullName}}
                        </div>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column prop="dm" label="门店" width="200">
                    <template scope="scope">
                        <el-popover
                        placement="top"
                        v-if="scope.row.dm"
                        popper-class="popper"
                        width="300"
                        trigger="hover">
                        <div>
                            {{scope.row.dm}}
                        </div>
                        <div class="hideone" slot="reference">
                            {{scope.row.dm}}
                        </div>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column prop="yyjl" label="营运经理" width="90">
                </el-table-column>
                <el-table-column prop="dd" label="督导" width="80">
                </el-table-column>
                <el-table-column prop="xm" label="员工姓名" width="90">
                </el-table-column>
                <el-table-column prop="bh" label="员工ID" width="160">
                </el-table-column>
                <el-table-column prop="attendDay" label="考勤天数" width="90">
                </el-table-column>
                <el-table-column prop="requestDay" label="请假次数" width="90">
                    <template slot-scope="scope">
                        <el-button v-on:click="openDetail(scope.row)" type="text">{{scope.row.requestDay}}</el-button>
                    </template>
                </el-table-column>
                <el-table-column fixed="right" label="操作">
                    <template slot-scope="scope">
                        <el-button v-on:click="handleClick(scope.row)" type="danger" size="small"
                            v-show="scope.row.attendDay==''&& flag">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pages">
                <el-pagination background layout="sizes, prev, pager, next" v-on:size-change="handleSizeChange"
                    v-on:current-change="handleCurrentChange" :total="total" :page-sizes="[20, 30, 40, 50]"
                    :page-size="pagesize">
                </el-pagination>
            </div>
        </div>
        <el-dialog title="" :visible.sync="dialogVisible" width="30%">
            <span slot="title" class="reject-title">提示</span>
            <div>是否删除？</div>
            <span slot="footer" class="dialog-footer">
                <el-button size="small" v-on:click="dialogVisible = false">否</el-button>
                <el-button size="small" type="primary" v-on:click="deleteConfirm">是</el-button>
            </span>
        </el-dialog>
        <el-dialog title="" :visible.sync="dialogVisibleBar" width="30%">
            <span slot="title" class="reject-title">提示</span>
            <div>此操作将批量删除选中数据, 是否继续?</div>
            <span slot="footer" class="dialog-footer">
                <el-button size="small" v-on:click="dialogVisibleBar = false">取消</el-button>
                <el-button size="small" type="primary" v-on:click="deleteBarConfirm">确定</el-button>
            </span>
        </el-dialog>
        <el-dialog title="" :visible.sync="dialogShowDetail" width="30%">
            <div class="textColor">
                <span>{{xm}}</span>
                <span>{{bh}}</span>
            </div>
            <el-table :data="tableDataDetail" style="width: 100%">
                <el-table-column type="index" prop="" label="序号" width="50">
                </el-table-column>
                <el-table-column prop="requestDetail" label="详情">
                </el-table-column>
            </el-table>
        </el-dialog>
        <el-dialog title="" :visible.sync="exportDialogVisible" width="30%">
            <span slot="title" class="reject-title">提示</span>
            <div class="text_style">数据导出中，由于数据量大，大概等待5分钟，请勿刷新页面或重复点击导出!</div>
            <span slot="footer" class="dialog-footer">
                <div class="my-button">
                    <el-button type="primary" v-on:click="handleExport">是</el-button>
                </div>
            </span>
        </el-dialog>
    </div>

    <script>
        var app = new Vue({
            el: '#app',
            data: {
                labelCol: { style: { width: '180px' } },
                formItemStyle: {
                    marginBottom: 0
                },
                tableData: [],
                pageIndex: 1,//当前页码
                pagesize: 20,//每页数量
                total: 0,//总条数
                dialogVisible: false,//删除框是否显示
                dialogVisibleBar: false,//一键删除框
                form2Visible: false,
                loading: false,//表格是否加载,
                form1: { // 创建单位管理form
                    province: '', // 行政区划——省
                    city: '', // 行政区划——市
                    region: '', // 行政区划——区
                    street: '', // 行政区划
                },
                searchType: 1,
                provinceList: [], // 存放一级区域
                cityList: [], // 存放二级区域
                regionList: [], // 存放三级区域
                streetList: [], //存放四级区域
                form: {
                    uname: '',
                    store: '请选择',//店名妖码
                    manager: '',
                    supervisor: ''
                },
                form2: {
                    departureStatus: 'YGZT02',// 查询离职状态
                    dingdingAttendHave: 2,// 查询21天是否有打卡记录
                    dingdingAttendNew: '',//是否有最新钉钉数据记录
                },
                managerData: [],//营运经理数据
                supervisorData: [],//督导数据
                nameData: [],//姓名数据
                storeData: [],//店名数据
                selectStore: "",//选择的店名名称
                selectData: [],//复选框选中的数据
                sel: {},//单选数据
                //查询离职状态
                departureStatusData: [
                    {
                        name: '全部',
                        value: ''
                    },
                    {
                        name: '正式员工',
                        value: 'YGZT02'
                    },
                    {
                        name: '离职员工',
                        value: 'YGZT03'
                    }
                ],
                //查询21天是否有打卡记录
                dingdingAttendHaveData: [
                    {
                        name: '全部',
                        value: ''
                    },
                    {
                        name: '有打卡记录',
                        value: 1
                    },
                    {
                        name: '无打卡记录',
                        value: 2
                    }
                ],
                //是否有最新钉钉数据记录
                dingdingAttendNewData: [
                    {
                        name: '全部',
                        value: ''
                    },
                    {
                        name: '有',
                        value: 1
                    },
                    {
                        name: '没有',
                        value: 2
                    }
                ],
                tableDataDetail: [],
                dialogShowDetail: false,
                xm: '',
                bh: '',
                flag: false,
                exportDialogVisible:false,
                fullscreenLoading:false,
                headerStyle:{color:'#0E2231',fontWeight:'blod',background:'#F7F5FA'},
                tableHeight:0
            },
            created() {
                this.getListData()//获取页面数据
                this.getManagers()
                this.getSupervisors()
                this.getStores()
                this.getNames()
                this.getProvinceList()//获取一级区域
                this.judgePermissions()//不是孙娇删除按钮就不管用
                this.getHeight()
            },
            mounted() { },
            methods: {
                getHeight(){
                    const {form2Visible} = this
                    let ava = document.documentElement.clientHeight
                    let height = ava - 214
                    if(form2Visible){
                        height = height - 51
                    }
                    this.tableHeight = height
                },
                //判断身份
                judgePermissions() {
                    let formData = new FormData()
                    const requestOptions = {
                        method: "POST",
                        body: {}
                    };
                    fetch("/dingdingDayAttend/deleteDingdingEmpByBhListPermissions", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.data) {
                                this.flag = true
                            } else {
                                this.flag = false
                            }
                        })
                },
                // 获取列表数据
                getListData() {
                    this.loading = true
                    if (this.searchType == 1) {
                        this.form1 = {}
                        let { uname, manager, supervisor, store } = this.form
                        let { departureStatus, dingdingAttendHave, dingdingAttendNew } = this.form2
                        let { pageIndex, pagesize } = this

                        let formData = new FormData();
                        formData.append("page", pageIndex);
                        formData.append("limit", pagesize);
                        formData.append("queryType", 2);
                        formData.append("nameOrBh", uname ? uname : '');
                        formData.append("yydh", manager ? manager : '');
                        formData.append("dddh", supervisor ? supervisor : '');
                        formData.append("dm", (!store || store == '请选择') ? '' : store);
                        formData.append("departureStatus", departureStatus ? departureStatus : '');
                        formData.append("dingdingAttendHave", dingdingAttendHave ? dingdingAttendHave : '');
                        formData.append("dingdingAttendNew", dingdingAttendNew ? dingdingAttendNew : '');
                        const requestOptions = {
                            method: "POST",
                            body: formData
                        };
                        fetch("/dingdingDayAttend/empAndDeptAndDingdingAttendList", requestOptions)
                            .then(response => response.json())
                            .then(res => {
                                if (res.code == 0) {
                                    this.total = res.count
                                    this.tableData = res.data
                                    this.loading = false
                                } else {
                                    this.loading = false
                                }
                            })
                    } else {
                        this.form = {}
                        let { province, city, region, street } = this.form1
                        let { departureStatus, dingdingAttendHave, dingdingAttendNew } = this.form2
                        let { pageIndex, pagesize } = this
                        let formData = new FormData();
                        formData.append("page", pageIndex);
                        formData.append("limit", pagesize);
                        formData.append("queryType", 1);
                        formData.append("levelOneId", province ? province : '');
                        formData.append("levelTwoId", city ? city : '');
                        formData.append("levelThreeId", region ? region : '');
                        formData.append("levelFourId", street ? street : '');
                        formData.append("departureStatus", departureStatus ? departureStatus : '');
                        formData.append("dingdingAttendHave", dingdingAttendHave ? dingdingAttendHave : '');
                        formData.append("dingdingAttendNew", dingdingAttendNew ? dingdingAttendNew : '');
                        const requestOptions = {
                            method: "POST",
                            body: formData
                        };
                        fetch("/dingdingDayAttend/empAndDeptAndDingdingAttendList", requestOptions)
                            .then(response => response.json())
                            .then(res => {
                                if (res.code == 0) {
                                    this.total = res.count
                                    this.tableData = res.data
                                    this.loading = false
                                } else {
                                    this.loading = false
                                }
                            })
                    }

                },

                //四级级联
                getProvinceList() {
                    let formData = new FormData()
                    formData.append("pid", 24)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/queryDepts", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res) {
                                this.provinceList = [{ name: "请选择", deptId: '' }, ...res]
                                this.loading = false
                            } else {
                                this.loading = false
                            }
                        })
                },
                changePr(val) {
                    this.$set(this.form1, "city", "")
                    this.$set(this.form1, "region", "")
                    this.$set(this.form1, "street", "")
                    this.streetList = []
                    let formData = new FormData()
                    formData.append("pid", val)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/queryDepts", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res) {
                                this.cityList = [{ name: "请选择", deptId: '' }, ...res]
                                this.loading = false
                            } else {
                                this.loading = false
                            }
                        })
                    // this.changeCi()
                    // this.changeRe()
                },
                changeCi(val) {
                    this.$set(this.form1, "region", "")
                    this.$set(this.form1, "street", "")
                    let formData = new FormData()
                    formData.append("pid", val)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/queryDepts", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res) {
                                this.regionList = [{ name: "请选择", deptId: '' }, ...res]
                                this.loading = false
                            } else {
                                this.loading = false
                            }
                        })
                    // this.changeRe()
                },
                changeRe(val) {
                    this.$set(this.form1, "street", "")
                    let formData = new FormData()
                    formData.append("pid", val)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/queryDepts", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res) {
                                this.streetList = [{ name: "请选择", deptId: '' }, ...res]
                                this.loading = false
                            } else {
                                this.loading = false
                            }
                        })
                },
                //选择框事件
                handleSelectionChange(val) {
                    this.selectData = val;
                },
                //高级查询弹框
                showMore() {
                    this.form2Visible = !this.form2Visible
                    this.getHeight()
                },
                //一键删除弹框
                deleteBar() {
                    this.dialogVisibleBar = true
                },
                //批量删除确认
                deleteBarConfirm() {
                    var ids = []
                    ids.push(this.selectData.map(item => item.bh))//获取所有选中行的id组成的字符串，以逗号分隔
                    let formData = new FormData()
                    formData.append("idList", ids)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/deleteDingdingEmpByBhList", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.code == 200) {
                                this.$message({
                                    message: '操作成功',
                                    type: 'success'
                                });
                            } else {
                                this.$message({
                                    message: res.message,
                                    type: 'error'
                                });
                            }
                            this.dialogVisibleBar = false
                            this.getListData()
                        })
                },

                // 搜索内容
                searchDo1() {
                    this.pageIndex = 1
                    this.searchType = 2
                    this.getListData()
                },
                // 搜索内容
                searchDo() {
                    this.pageIndex = 1
                    this.searchType = 1
                    this.getListData()
                },
                // 重置搜索条件form1
                resetDo1() {
                    this.form1 = {
                        uname: "",
                        manager: "",
                        supervisor: "",
                        store: "",
                    }
                    this.pageIndex = 1
                    setTimeout(() => {
                        this.getListData()
                        this.getSupervisors()
                        this.getStores()
                    }, 0);
                },
                // 重置搜索条件
                resetDo() {
                    this.form = {
                        uname: "",
                        manager: "",
                        supervisor: "",
                        store: "",
                    }
                    this.pageIndex = 1
                    setTimeout(() => {
                        this.getListData()
                        this.getSupervisors()
                        this.getStores()
                    }, 0);
                },
                //每页记录数
                handleSizeChange(val) {
                    this.pagesize = val
                    this.getListData()
                },
                // 页码改变
                handleCurrentChange(val) {
                    this.pageIndex = val
                    this.getListData()
                },
                //展示请假详情
                openDetail(row) {
                    this.dialogShowDetail = true
                    this.xm = row.xm
                    this.bh = row.bh
                    this.showDetail(this.bh)
                },
                showDetail(bh) {
                    let formData = new FormData()
                    formData.append("bh", bh)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/queryRequestDetailByBh", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.code == 200) {
                                this.tableDataDetail = res.data
                            }
                        })
                },
                // 删除操作
                handleClick(row) {
                    this.dialogVisible = true
                    this.sel = row
                },
                // 删除确认操作
                deleteConfirm() {
                    var ids = []
                    ids.push(this.sel.bh)
                    let formData = new FormData()
                    formData.append("idList", ids)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/deleteDingdingEmpByBhList", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.code == 200) {
                                this.$message({
                                    message: '操作成功',
                                    type: 'success'
                                });
                            } else {
                                this.$message({
                                    message: res.message,
                                    type: 'error'
                                });
                            }
                            this.dialogVisible = false
                            this.getListData()
                        })

                },
                // 获取营运经理数据
                getManagers() {
                    let formData = new FormData()
                    formData.append("page", 1)
                    formData.append("limit", 10000)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/listYyjl", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.code == 0) {
                                this.managerData = [{ yyjl: "请选择", yydh: "" }, ...res.data]
                            }
                        })
                },
                // 获取督导数据
                getSupervisors() {
                    let { manager } = this.form
                    let formData = new FormData()
                    formData.append("page", 1)
                    formData.append("limit", 10000)
                    formData.append("yydh", manager ? manager : '')
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/listDd", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.code == 0) {
                                this.supervisorData = [{ dd: "请选择", dddh: "" }, ...res.data]
                            }
                        })
                },
                // 获取店名数据
                getStores() {
                    let { manager, supervisor } = this.form
                    let formData = new FormData()
                    formData.append("page", 1)
                    formData.append("limit", 10000)
                    formData.append("yydh", manager ? manager : '')
                    formData.append("dddh", supervisor ? supervisor : '')
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/listDm", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.code == 0) {
                                this.storeData = [{ dm: "请选择" }, ...res.data]
                            }
                        })
                },
                // 获取姓名数据
                getNames() {
                    let formData = new FormData()
                    formData.append("page", 1)
                    formData.append("limit", 10000)
                    const requestOptions = {
                        method: "POST",
                        body: formData
                    };
                    fetch("/dingdingDayAttend/listXm", requestOptions)
                        .then(response => response.json())
                        .then(res => {
                            if (res.code == 0) {
                                //this.nameData = res.data.filter(item => item.attendDay==null||item.attendDay==0);
                                this.nameData = res.data
                            }
                        })
                },
                // 营运经理改变
                changeManager(val) {
                    this.getStores()
                    this.getSupervisors()
                    this.$set(this.form, "supervisor", "")
                    this.$set(this.form, "store", "")
                },
                //督导改变
                changeSupervisor(val) {
                    this.getStores()
                    this.$set(this.form, "store", "")
                },
                // 店名改变
                changeStore(item) {

                },
                // form1条件导出
                exportDo1() {
                    let { province, city, region, street } = this.form1
                    let { departureStatus, dingdingAttendHave, dingdingAttendNew } = this.form2

                    if(province!=''&&city=='') {
                        province = province ? province : ''
                        city = city ? city : ''
                        region = region ? region : ''
                        street = street ? street : ''
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?levelOneId="
                            + province + "&levelTwoId=" + city + "&levelThreeId=" + region + "&levelFourId=" + street + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=1"

                        this.exportDialogVisible = true
                    }else{
                        const loading = this.$loading({
                            lock: true,
                            text: 'Loading',
                            spinner: 'el-icon-loading',
                            background: 'rgba(0, 0, 0, 0.7)'
                        });
                        province = province ? province : ''
                        city = city ? city : ''
                        region = region ? region : ''
                        street = street ? street : ''
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?levelOneId="
                            + province + "&levelTwoId=" + city + "&levelThreeId=" + region + "&levelFourId=" + street + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=1"

                        setTimeout(() => {
                            loading.close();
                        }, 2500);
                    }
                },

                // form2条件导出
                exportDo2() {
                    let { uname, manager, supervisor, store } = this.form
                    let { departureStatus, dingdingAttendHave, dingdingAttendNew } = this.form2
                    if(manager!=''&&supervisor=='') {
                        const loading = this.$loading({
                            lock: true,
                            text: 'Loading',
                            spinner: 'el-icon-loading',
                            background: 'rgba(0, 0, 0, 0.7)'
                        });
                        uname = uname ? uname : ''
                        manager = manager ? manager : ''
                        supervisor = supervisor ? supervisor : ''
                        store = (!store || store == '请选择') ? '' : store
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?nameOrBh="
                            + uname + "&yydh=" + manager + "&dddh=" + supervisor + "&dm=" + store + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=2"
                        setTimeout(() => {
                            loading.close();
                        }, 5000);
                    }else{
                        const loading = this.$loading({
                            lock: true,
                            text: 'Loading',
                            spinner: 'el-icon-loading',
                            background: 'rgba(0, 0, 0, 0.7)'
                        });

                        uname = uname ? uname : ''
                        manager = manager ? manager : ''
                        supervisor = supervisor ? supervisor : ''
                        store = (!store || store == '请选择') ? '' : store
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?nameOrBh="
                            + uname + "&yydh=" + manager + "&dddh=" + supervisor + "&dm=" + store + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=2"
                        setTimeout(() => {
                            loading.close();
                        }, 2500);
                    }
                },
                // 删除操作
                handleExport() {
                    this.exportDialogVisible = false
                },
                // form1条件导出
                exportDoGroup1() {
                    let { province, city, region, street } = this.form1
                    let { departureStatus, dingdingAttendHave, dingdingAttendNew } = this.form2

                    if(province!=''&&city=='') {
                        province = province ? province : ''
                        city = city ? city : ''
                        region = region ? region : ''
                        street = street ? street : ''
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?levelOneId="
                            + province + "&levelTwoId=" + city + "&levelThreeId=" + region + "&levelFourId=" + street + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=1"

                        this.exportDialogVisible = true
                    }else{
                        const loading = this.$loading({
                            lock: true,
                            text: 'Loading',
                            spinner: 'el-icon-loading',
                            background: 'rgba(0, 0, 0, 0.7)'
                        });
                        province = province ? province : ''
                        city = city ? city : ''
                        region = region ? region : ''
                        street = street ? street : ''
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?levelOneId="
                            + province + "&levelTwoId=" + city + "&levelThreeId=" + region + "&levelFourId=" + street + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=1"

                        setTimeout(() => {
                            loading.close();
                        }, 5000);
                    }
                },
                // form2条件导出
                exportDoGroup2() {
                    let { uname, manager, supervisor, store } = this.form
                    let { departureStatus, dingdingAttendHave, dingdingAttendNew } = this.form2
                    if(manager!=''&&supervisor=='') {
                        const loading = this.$loading({
                            lock: true,
                            text: 'Loading',
                            spinner: 'el-icon-loading',
                            background: 'rgba(0, 0, 0, 0.7)'
                        });
                        uname = uname ? uname : ''
                        manager = manager ? manager : ''
                        supervisor = supervisor ? supervisor : ''
                        store = (!store || store == '请选择') ? '' : store
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?nameOrBh="
                            + uname + "&yydh=" + manager + "&dddh=" + supervisor + "&dm=" + store + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=2"
                        setTimeout(() => {
                            loading.close();
                        }, 5000);
                    }else{
                        const loading = this.$loading({
                            lock: true,
                            text: 'Loading',
                            spinner: 'el-icon-loading',
                            background: 'rgba(0, 0, 0, 0.7)'
                        });

                        uname = uname ? uname : ''
                        manager = manager ? manager : ''
                        supervisor = supervisor ? supervisor : ''
                        store = (!store || store == '请选择') ? '' : store
                        departureStatus = departureStatus ? departureStatus : ''
                        dingdingAttendHave = dingdingAttendHave ? dingdingAttendHave : ''
                        dingdingAttendNew = dingdingAttendNew ? dingdingAttendNew : ''

                        window.location.href = "/dingdingDayAttend/exportEmpAndDeptAndDingdingAttendList?nameOrBh="
                            + uname + "&yydh=" + manager + "&dddh=" + supervisor + "&dm=" + store + "&departureStatus="
                            + departureStatus + "&dingdingAttendHave=" + dingdingAttendHave + "&dingdingAttendNew=" + dingdingAttendNew + "&queryType=2"
                        setTimeout(() => {
                            loading.close();
                        }, 2500);
                    }
                },
            }
        })
    </script>
</body>
@}